package com.smzd.framework.utils;

import net.sf.json.JSONObject;

public abstract class JsonConverter<E> {
	private JSONObject self = new JSONObject();

	protected abstract void accumulate(JSONObject json, E elem);

	public String toJsonString(E elem) {
		if (elem != null) {
			accumulate(self, elem);
		}
		return self.toString();
	}
}
